package com.chenyongjing.design.pattern.memento.general;

/**
 * 发起人，创建备忘录
 * @Author chen
 * @Date 2022/11/23 22:12
 */
public class Originator {
    private Memento memento;

    public String getSate() {
        return memento.getSate();
    }

    public void setSate(String sate) {
        this.memento.setSate(sate);
    }

    /**
     * 创建快照
     * @return
     */
    public Memento createMemento(){
        this.memento = new Memento();
        return this.memento;
    }

    /**
     * 撤销操纵
     * @param memento
     */
    public void restoreMemento(Memento memento){
        this.memento = memento;
    }
}
